import fetch from '../../utils/fetch.js'
Page({

  data: {
    id: '',
    info: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.id = options.id
    this.setData(this.data)
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    fetch({
      url:`shops/${this.data.id}`
    }).then(res => {
      this.data.info = res.data
      this.setData(this.data)
    })
  },

  //图片预览
  preview(e){
    let {current,urls} = e.currentTarget.dataset
    console.log(current);
    current = current.replace('w.h','1000.1000')
    urls = urls.map(item => item.replace('w.h','1000.1000'))
    wx.previewImage({
      urls: urls,
      current: current
    })
  }
})